package com.situ.mall.common.exception;

import com.situ.mall.common.util.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public Result handleException(Exception e) {
        e.printStackTrace();
        return Result.error(e.getMessage());
    }

    @ExceptionHandler(value = SituException.class)
    @ResponseBody
    public Result handleException(SituException e) {
        e.printStackTrace();
        return Result.error(e.getMessage());
    }
}
